home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 499 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.6 KB

  1. Path: solon.com!not-for-mail
  2. From: larry.jones@sdrc.com (Larry Jones)
  3. Newsgroups: comp.lang.c.moderated,comp.std.c
  4. Subject: Re: Behaviour of mem functions when n=0 ?
  5. Date: 4 Mar 1996 21:23:25 -0600
  6. Organization: SDRC Engineering Services
  7. Sender: clc@solutions.solon.com
  8. Approved: clc@solutions.solon.com
  9. Message-ID: <4hgc3d$97a@solutions.solon.com>
  10. References: <4hdqn5$8qn@solutions.solon.com>
  11. NNTP-Posting-Host: solutions.solon.com
  12.  
  13. In article <4hdqn5$8qn@solutions.solon.com>, fred@genesis.demon.co.uk
  14. (Lawrence Kirby) writes about memcmp et al. with n==0:
  15. > Probably. However the result is defined by some rather unfortunate wording in
  16. > the standard:
  17.  
  18. The intent of the standard has been clarified by a Technical Corrigendum
  19. which adds the following text to the introductory matter in 7.11.1
  20. String Function Conventions:
  21.  
  22.     Where an argument declared as |size_t n| specifies the length of
  23.     the array for a function, |n| can have the value zero on a call
  24.     to that function.  Unless explicitly stated otherwise in the
  25.     description of a particular function in this subclause, pointer
  26.     arguments on such a call must still have valid values, as
  27.     described in subclause 7.1.7.  On such a call, a function that
  28.     locates a character finds no occurrence, a function that
  29.     compares two character sequences returns zero, and a function
  30.     that copies characters copies zero characters.
  31.  
  32. Note that this applies to the strn* functions as well as the mem*
  33. functions.
  34. ----
  35. Larry Jones, SDRC, 2000 Eastman Dr., Milford, OH  45150-2789  513-576-2070
  36. larry.jones@sdrc.com
  37. Well of course the zipper's going to get stuck if everyone
  38. stands around WATCHING me! -- Calvin
  39.